package cn.wolfcode.wolf2w.business.controller;

import cn.wolfcode.wolf2w.api.domain.QuestionLabel;
import cn.wolfcode.wolf2w.business.query.QuestionLabelQuery;
import cn.wolfcode.wolf2w.business.service.IQuestionLabelService;
import cn.wolfcode.wolf2w.common.core.domain.R;
import cn.wolfcode.wolf2w.common.security.annotation.InnerAuth;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 问答标签表 Controller
 * 
 * @author 浪兎兎
 * @date 2025-06-07
 */
@RestController
@RequestMapping("questionLabels")
public class QuestionLabelController {
    @Autowired
    private IQuestionLabelService questionLabelService;
    /**
     * 问答标签表详情
     */
    @GetMapping("/detail/{id}")
    public R<QuestionLabel> detail(@PathVariable Long id) {
        QuestionLabel questionLabel = questionLabelService.getById(id);
        return R.ok(questionLabel);
    }
    /**
     * 问答标签表 列表
     */
    @GetMapping("/query")
    public R<IPage<QuestionLabel>> query(QuestionLabelQuery qo) {
        IPage<QuestionLabel> page = questionLabelService.queryPage(qo);
        return R.ok(page);
    }


    /*****************************************对外暴露Fegin接口**********************************************/
    /**
     * Feign 接口
     */
    @GetMapping("/feign/list")
    public R<List<QuestionLabel>> feignList() {
        return R.ok(questionLabelService.list());
    }
    @InnerAuth
    @GetMapping("/feign/{id}")
    public R<QuestionLabel> feignGet(@PathVariable Long id) {
        return R.ok(questionLabelService.getById(id));
    }
}
